package com.zby.ss.util;

import java.io.File;
import java.lang.reflect.Array;
import java.util.*;

/**
 * Created By zby on 15:29 2019/2/14
 * 集合容器
 */

public class CollectionUtil {

    /**
     * Created By zby on 15:29 2019/2/14
     * 判断集合是否为空，条件为集合为null，以及集合的大小不为0
     */
    public static boolean isEmpty(Collection collection) {
        return null == collection || collection.size() == 0 ? true : false;
    }

    /**
     * Created By zby on 15:29 2019/2/14
     * 判断集合是否为空，条件为集合为null，以及集合的大小不为0
     */
    public static boolean isNotEmpty(Collection collection) {
        return null != collection && collection.size() > 0 ? true : false;
    }

    /**
     * Created By zby on 23:24 2019/2/14
     * 将list转化为set,如果list为null，转换就会报错
     */
    public static Set listToSet(List list) {
        return isNotEmpty(list) ? new HashSet(list) : new HashSet();
    }


}
